import request from '@/utils/request'
import qs from 'qs'
// 读取站点下的用户组列表
export function GroupList(data) {
  return request({
    url: '/group/getGroupList',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

//17 读取用户组设置的人员列表
export function GroupUserList(data) {
  return request({
    url: '/group/privilegeSetup',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

// 将用户加入用户组
export function moveInUser(data) {
  return request({
    url: '/group/moveInUser',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

// 将用户移出用户组
export function moveOutUser(data) {
  return request({
    url: '/group/moveOutUser',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

//18 新建用户组
export function addGroup(data) {
  return request({
    url: '/group/addGroup',
    method: 'post',
    data: data
  })
}
// 读取用户组信息
export function groupDetail(data) {
  return request({
    url: '/group/getGroup',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}
//删除用户组
export function delGroup(data) {
  return request({
    url: '/group/delGroup',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

//19 编辑用户组
export function editGroup(data) {
  return request({
    url: '/group/editGroup',
    method: 'post',
    data: data
  })
}

//3  将选择的网站的所有栏目赋予当前用户组    
export function autoPrivlige(data) {
  return request({
    url: '/group/autoPrivlige',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

//2 保存用户组可见的站点栏目权限配置
export function savePrivilegeConfig(data) {
  return request({
    url: '/group/savePrivilegeConfig',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}


//1 获取当前用户组已经拥有的权限
export function initializePrivilege(data) {
  return request({
    url: '/group/initializePrivilege',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}




// 35 获取站点下已有权限的栏目id
export function getSlecteChannelList(data) {
  return request({
    url: '/channel/getSelectChannelListForGroup',
    headers: { 'content-type': 'application/x-www-form-urlencoded', },
    method: 'post',
    data: qs.stringify(data)
  })
}















